package com.longma.server.constant.enums;

/**
 * 流播放协议
 */
public enum ProtocolEnum implements IBaseEnum<Integer>{
    EZOPEN(1,"ezopen"),

    HLS(2,"hls"),

    RTML(3,"rtmp"),

    FLV(4,"flv");

    /**
     * 值
     */
    private int value;

    /*
     * 描述信息
     */
    private String desc;

    /**
     * 构造函数
     */
    ProtocolEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    /**
     * 通过值转为枚举类型
     */
    public static ProtocolEnum fromValue(int value) {
        switch (value) {
            case 1:
                return EZOPEN;
            case 2:
                return HLS;
            case 3:
                return RTML;
            case 4:
                return FLV;
            default:
                throw new IllegalArgumentException();
        }
    }

    /**
     * 获取值
     */
    @Override
    public Integer getValue() {
        return this.value;
    }

    @Override
    public String getDesc() {
        return  this.desc;
    }
}

